﻿Public Class FoodShop

    Dim vType As Integer = 1
    Dim vPrice As Integer
    Dim vImage As Integer
    Dim vChosen As Boolean
    Dim vStatus As Boolean = 0

    Public Property Type() As Integer
        Get
            Return vType
        End Get
        Set(ByVal value As Integer)
            vType = value
            ChangeType(value)
        End Set
    End Property

    Public Property Chosen() As Boolean
        Get
            Return vChosen
        End Get
        Set(ByVal value As Boolean)
            vChosen = value
            CheckChosen()
        End Set
    End Property

    Public Property Status() As Boolean
        Get
            Return vStatus
        End Get
        Set(ByVal value As Boolean)
            vStatus = value
            ChangeStatus()
        End Set
    End Property

    Private Property Price() As Integer
        Get
            Return vPrice
        End Get
        Set(ByVal value As Integer)
            vPrice = value
            LblPrice.Text = "$" & value
        End Set
    End Property

    Public Sub ChangeType(ByVal value As Integer)
        Dim name As String = ""

        Select Case value
            Case 0
                name = "Bad"
                Price = "1"
            Case 1
                name = "Good"
                Price = "2"
            Case 2
                name = "Best"
                Price = "5"
        End Select

        LblName.Text = name
        Aligned()

        If (Status = True) Then
            Me.BackgroundImage = ShopList.Images(value)
        End If
    End Sub

    Public Sub ChangeStatus()
        If Status = True Then
            Me.BackgroundImage = ShopList.Images(Type)
            LblPrice.Visible = True
        Else
            Me.BackgroundImage = ShopList.Images(3)
            LblPrice.Visible = False
        End If
    End Sub

    Public Sub CheckChosen()
        If (Chosen = True) Then
            Me.BackgroundImage = BgList.Images(Type)
        Else
            Me.BackgroundImage = ShopList.Images(Type)
        End If
    End Sub

    Private Sub Aligned()
        LblName.Left = (Me.Width - LblName.Width) / 2
        LblPrice.Left = (Me.Width - LblPrice.Width) / 2
        FoodImage.Left = (Me.Width - FoodImage.Width) / 2
    End Sub

    Public Function GetPrice()
        Return Price
    End Function

End Class
